package com.echat.messagesender.sender.config;

import com.echat.messagesender.sender.util.IdGenerator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by chenmohan on 2018/09/07
 *
 * @description
 */
@Configuration
public class IdGeneratorConfig {

    @Value("${idGenerator.dataCenterId}")
    private int dataCenterId;

    @Value("${idGenerator.workId}")
    private int workId;

    @Bean
    public IdGenerator idGenerator(){
        IdGenerator idGenerator = new IdGenerator(workId,dataCenterId);
        return idGenerator;
    }

}
